<?php

/**
 * Created by PhpStorm.
 * User: yuchong
 * Date: 2015/2/4
 * Time: 9:53
 */

class Type_model extends MY_Model {

    public function __construct() {
        parent::__construct();
        $this->_table = "db_type";
    }

    /**
     *   获取栏目列表
     */
    public function getList() {
        $return = $this->db->from($this->_table)->get()->result_array();
        return $return ? $return : false;
    }

    /**
     * auto:xg
     * 获取栏目详情
     */
    public function getTypeinfo($catid=''){
        $info = $this->db->get_where($this->_table, array('catid' => $catid))->row_array();
        return $info;
    }

    /**
     * auto:xg
     * 保存栏目信息
     */
    public function set_type_info($set_date='', $catid=''){
        if($catid == 0){
            $this->db->insert($this->_table, $set_date);
        }else{
            $this->db->where('catid', $catid);
            $this->db->update($this->_table, $set_date);
        }
        return $this->db->affected_rows();
    }

}